#pragma once

namespace TSE
{
	class FileSystem;
	class ScriptSystem;
	class IConnection;
	class Engine
	{
	public:
		~Engine();

		static Engine &ref();

		void Main(int argc, char *argv[]);
		void tick(double dt);

	//FILE
	public:
		CL_String getRootPath();

	//SCRIPT
	public:
		void runScript(const CL_String &script);
		void runScript(const CL_String &rel_path, const CL_String &filename);
		void expose();

	//NETWORK
	public:
		bool dispatch(const CL_String &line, IConnection *connection);
		int login(const CL_String &username, const CL_String &password);

	public:
		FileSystem &getFileSystem() const { return *file; }
		ScriptSystem &getScriptSystem() const { return *script; }

	private:
		Engine();
		CL_SetupCore setupCore;
		
		FileSystem *file;
		ScriptSystem *script;
	};
}
